import React from 'react'
import PropTypes from 'prop-types'
function Item({dataChildren}) {
  return (
    <div>
         {
            dataChildren&&dataChildren.map((val,index)=>{
                return <div key={index}>
                    <p>title:{val.title}</p>
                    <img src={val.img} alt="图片错误" />
                </div>
            })
        }
    </div>
  )
}

//设置默认参数
Item.defaultProps = {
    dataChildren: [{title:"暂无数据"}]
}
//类型校验
Item.propTypes = {
    dataChildren: PropTypes.array.isRequired,
    id:PropTypes.number
}

export default Item